//
//  MainNavView.m
//  KeTianDemo
//
//  Created by jay on 2020/8/24.
//  Copyright © 2020 jay. All rights reserved.
//

#import "MainNavView.h"

@implementation MainNavView

- (id)initWithFrame:(CGRect)frame {
    self = [super initWithFrame:frame];
    if (self) {
        self.backgroundColor = TX_COLOR_FROM_RGB(0xF7F7F7);
                
        self.searchView.hidden = NO;
    }
    return self;
}

#pragma mark - Getter

-(UIView *)contentBgView {
    if (_contentBgView == nil) {
        _contentBgView = [UIView new];
        [self addSubview:_contentBgView];
        
        [_contentBgView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.right.mas_equalTo(0);
            make.top.mas_equalTo(TX_STATUSBAR_HEIGHT);
            make.bottom.mas_equalTo(0);
        }];
    }
    return _contentBgView;
}

- (TXSearchInputBox *)searchView {
    if(_searchView == nil) {
        _searchView = [[TXSearchInputBox alloc] init];
        [_searchView setLayerCorner:5];
        _searchView.backgroundColor = TX_COLOR_FROM_RGB(0xFFFFFF);
        [_searchView setLeftViewIcon:[UIImage imageNamed:@"search_black"]];
        [_searchView setInputTextColor:TX_COLOR_FROM_RGB(0x333333) textFont:TX_FONT(12)];
        [self.contentBgView addSubview:_searchView];
        
        [_searchView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.mas_equalTo(20);
            make.right.mas_equalTo(-20);
            make.height.mas_equalTo(30);
            make.centerY.mas_equalTo(0);
        }];
    }
    return _searchView;
}

@end
